# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=jpexs-decompiler
pkgver=15.1.0
pkgrel=1
pkgdesc='JPEXS Free Flash Decompiler.'
groups=('blackarch' 'blackarch-decompiler')
arch=('any')
url='https://github.com/jindrapetrik/jpexs-decompiler'
license=('GPL3')
depends=('java-environment')
source=("https://github.com/jindrapetrik/$pkgname/releases/download/version$pkgver/ffdec_$pkgver.zip")
sha512sums=('22336a1741707835b7abc5ae2ad2617d69d44ce76b8ba3f33e9c966f4be0a93689f394ba2a9ca329cf2d0d014d476a18f5cdce86439522881a576b463b6a2a43')

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" CHANGELOG.md
  install -Dm 644 license.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm *.md license.txt "ffdec_$pkgver.zip"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec java -jar ffdec.jar "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

